# main.py

import math_functions

# 模拟的题库，这里简单用一个列表存储题目编号及对应函数引用
question_bank = [
    (1, math_functions.print_multiplication_table),
    (2, math_functions.prime_factorization),
    (3, math_functions.process_number),
    (4, math_functions.sum_series),
    (5, math_functions.fraction_sum),
    (6, math_functions.find_number),
    (7, math_functions.rabbit_count),
    (8, math_functions.matrix_sum),
    (9, math_functions.shift_numbers),
    (10, math_functions.sum_fractions_by_odd_even)
]


def display_menu():
    """显示操作菜单界面"""
    print("欢迎使用数学功能程序！")
    print("1. 执行题目功能")
    print("2. 增加题库内容（暂未实现完整添加新功能逻辑，可扩展）")
    print("3. 索引题库内容")
    print("4. 退出")


def add_to_question_bank():
    """
    增加内容到题库，这里简单打印提示，可后续扩展为真正添加新功能逻辑
    """
    print("此功能暂未完全实现，后续可扩展添加新题目及对应函数到题库。")


def index_question_bank():
    """索引显示题库中的内容"""
    if not question_bank:
        print("题库为空！")
    else:
        print("题库内容如下：")
        for index, (question_num, _) in enumerate(question_bank, start=1):
            print(f"{index}. 题目{question_num}")


while True:
    display_menu()
    choice = input("请输入你的选择（数字1-4）：")
    if choice == "1":
        index_question_bank()
        question_choice = int(input("请选择要执行的题目编号："))
        if 1 <= question_choice <= len(question_bank):
            func = question_bank[question_choice - 1][1]
            func()
        else:
            print("无效的题目编号，请重新输入！")
    elif choice == "2":
        add_to_question_bank()
    elif choice == "3":
        index_question_bank()
    elif choice == "4":
        print("感谢使用，程序已退出！")
        break
    else:
        print("无效的选择，请重新输入！")